package com.xjrsoft.common.dbmodel;

import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import cn.hutool.db.Page;
import cn.hutool.db.PageResult;
import cn.hutool.db.sql.SqlBuilder;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class XjrDb extends Db {
    public XjrDb(DataSource ds) {
        super(ds);
    }

    public static XjrDb use(DataSource ds) {
        return ds == null ? null : new XjrDb(ds);
    }

    public PageResult<Entity> page(SqlBuilder sql, Page page) throws SQLException {
        Connection conn = null;

        PageResult var4;
        try {
            conn = this.getConnection();
            var4 = this.runner.page(conn, sql, page);
        } finally {
            this.closeConnection(conn);
        }

        return var4;
    }
}
